import { createReplyBottomAtt, replaceFun } from '../../../util/CoworkUtil';
import { WeaLocaleProvider } from 'ecCom';

const getLabel = WeaLocaleProvider.getLabel;

class QuoteItem extends React.Component {
  constructor(props) {
    super(props);
  }

  render() {
    const { approvalAtatus, discussantInfo = {}, remark, floorNum, showDate, isAnonymous } = this.props;
    const { relatedaccList4E9 = [], relatedcusList4E9 = [], relateddocList4E9 = [], relatedprjList4E9 = [], relatedwfList4E9 = [], relatemutilprjs4E9 = [] } = this.props;
    return (
      <div className="wea-cowork-reply-item cowork-quote">
        <div>
          <div>
            <div className="cowork-reply-content">
              <div>
                <span className="cowork-reply-user">
                  <span className="quote-span">{getLabel(19422, '引用')}#{floorNum}</span>
                  {isAnonymous == 1 ? <span >{discussantInfo.lastname}</span> :
                    <a href={`javaScript:openhrm(${discussantInfo.id});`} onClick={window.pointerXY}>{discussantInfo.lastname}</a>}
                  <span className="reply-time">{showDate}</span>
                </span>
              </div>
              <div className="cowork-reply-remark">
                <div
                  className="wea-cl-content"
                  dangerouslySetInnerHTML={{ __html: `<div class="wea-ckeditor-content">${replaceFun(remark)}</div>` }}
                />
                {approvalAtatus == '1' && <span className="wait-approve">{getLabel(83261, '等待管理员审批')}</span>}
              </div>
              <div>
                {createReplyBottomAtt('icon-portal-content-o', getLabel(857, '相关文档'), relateddocList4E9)}
                {createReplyBottomAtt('icon-portal-Workflow-o', getLabel(1044, '相关流程'), relatedwfList4E9)}
                {createReplyBottomAtt('icon-portal-crm-o', getLabel(783, '相关客户'), relatedcusList4E9)}
                {createReplyBottomAtt('icon-portal-project', getLabel(782, '相关项目'), relatemutilprjs4E9)}
                {createReplyBottomAtt('icon-coms-Approval-o', getLabel(33414, '相关任务'), relatedprjList4E9)}
                {createReplyBottomAtt('icon-coms-currency-Enclosure', getLabel(22194, '相关附件'), relatedaccList4E9, true)}
              </div>
            </div>
          </div>
        </div>
      </div>
    );
  }
}

export default QuoteItem;
